//
//  OAGongHaoVC.m
//  OA项目
//
//  Created by innofive on 2018/4/26.
//  Copyright © 2018年 inno. All rights reserved.
//

#import "OAGongHaoVC.h"
#import "OAMyInfoCell.h"
#import "OASelectBuMenVC.h"
#import "UIBarButtonItem+Extension.h"
@interface OAGongHaoVC ()

@end

@implementation OAGongHaoVC

- (void)viewDidLoad {
    [super viewDidLoad];
    
    UIBarButtonItem *rightItem =[UIBarButtonItem OnCreateBarBtnItemName:@"保存" BarBtnstyle:(RightBarBtnItemStyle) Btntag:10 target:self action:@selector(onRightButton:)];
    self.navigationItem.rightBarButtonItem = rightItem;
}
#pragma mark - 点击事件
-(void)onRightButton:(UIButton *)button
{
    
}
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    if (self.type==openTypeZhiWei) {
        if (indexPath.row==0) {
            OASelectBuMenVC *vc = [[OASelectBuMenVC alloc]initWithStyle:(UITableViewStyleGrouped)];
            vc.title = @"选择部门";
            [self pushToVC:vc];
        }
        
    }
}

#pragma mark - Table view data source
-(void)onSetSubviewSELForCell:(BaseTableViewCell *)cell forTableView:(UITableView *)tableView forIndexPath:(NSIndexPath *)indexPath
{
    cell.selectionStyle = UITableViewCellSelectionStyleNone;
}
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return self.datas.count;
}

-(MCCellInfo *)tableView:(UITableView *)tableView cellForIndexPath:(NSIndexPath *)indexPath IsHeight:(BOOL)isheight
{
    if (self.type==openTypeAddress||self.type==openTypeJiaAddress) {
        return [MCCellInfo configForCellId:cell Class:[OAMyInfo4Cell class] Height:kFitH(100) TableView:tableView];
    }else if (self.type==openTypeZhiWei)
    {
        if (indexPath.row==0) {
              return [MCCellInfo configForCellId:cell2 Class:[OAMyInfo2Cell class] Height:kFitH(50) TableView:tableView CellStyle:(UITableViewCellStyleValue1)];
        }
           return [MCCellInfo configForCellId:cell1 Class:[OAMyInfo5Cell class] Height:kFitH(50) TableView:tableView];
    }
    else if(self.type==openTypejinJi)
    {
        return [MCCellInfo configForCellId:cell Class:[OAMyInfo6Cell class] Height:kFitH(50) TableView:tableView];
    }
    
        return [MCCellInfo configForCellId:cell Class:[OAMyInfo3Cell class] Height:kFitH(50) TableView:tableView];
}

-(MCHFViewInfo *)tableView:(UITableView *)tableView HeaderInSection:(NSInteger)section isBiao:(BOOL)isBiao
{
        return [MCHFViewInfo configForViewId:header Class:[BaseTableViewHeaderFooterView class] Height:kFitH(10) TableView:tableView IsBian:NO];
}

-(id)cellInitForSourceAtIndexPath:(NSIndexPath *)indexPath
{
    return self.datas[indexPath.row];
}
-(id)modelForIndexPath:(NSIndexPath *)indexPath
{
    if (self.type==openTypeZhiWei||self.type==openTypejinJi) {
        return self.datas[indexPath.row];
    }
    return nil;
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end
